package com.kmproject.haifu.mvp.ui.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.View;
import android.view.Window;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.blankj.utilcode.util.AppUtils;
import com.google.gson.Gson;
import com.irozon.library.HideKey;
import com.jess.arms.base.BaseActivity;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.http.imageloader.glide.ImageConfigImpl;
import com.jess.arms.utils.ArmsUtils;
import com.jess.arms.utils.DataHelper;
import com.jess.arms.widget.CustomPopupWindow;
import com.jess.arms.widget.alertview.AlertView;
import com.jess.arms.widget.alertview.AlertViewOnItemClickListener;
import com.jess.arms.widget.autolayout.AutoToolbar;
import com.kmproject.haifu.R;
import com.kmproject.haifu.app.AppConstant;
import com.kmproject.haifu.app.utils.AppUtil;
import com.kmproject.haifu.app.utils.StringUtils;
import com.kmproject.haifu.di.component.DaggerHousePublishDuanZuPublishComponent;
import com.kmproject.haifu.mvp.contract.HousePublishDuanZuPublishContract;
import com.kmproject.haifu.mvp.model.api.Api;
import com.kmproject.haifu.mvp.model.entity.MessageEvent;
import com.kmproject.haifu.mvp.model.entity.beans.HousePayWayBean;
import com.kmproject.haifu.mvp.model.entity.beans.HouseRentListShowInfoBean;
import com.kmproject.haifu.mvp.model.entity.beans.MemberCenterUserInfoBean;
import com.kmproject.haifu.mvp.model.entity.beans.MyStoryBean;
import com.kmproject.haifu.mvp.model.entity.beans.UserBean;
import com.kmproject.haifu.mvp.model.entity.beans.UserSfBean;
import com.kmproject.haifu.mvp.model.entity.resbean.HousePublicBean;
import com.kmproject.haifu.mvp.model.entity.resbean.ImgBean;
import com.kmproject.haifu.mvp.model.entity.resbean.SelectAddressMapBean;
import com.kmproject.haifu.mvp.presenter.HousePublishDuanZuPublishPresenter;
import com.kmproject.haifu.mvp.ui.widget.MultiSelectPopWindow;
import com.kmproject.haifu.mvp.ui.widget.MultiSelectPopWindow1;
import com.xw.repo.XEditText;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

import static com.jess.arms.utils.Preconditions.checkNotNull;


/**
 * ================================================
 * Description:
 * <p>
 * Created by MVPArmsTemplate on 06/26/2019 18:09
 * <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
 * <a href="https://github.com/JessYanCoding">Follow me</a>
 * <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
 * <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
 * <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
 * ================================================
 */
public class HousePublishDuanZuPublishActivity extends BaseActivity<HousePublishDuanZuPublishPresenter> implements HousePublishDuanZuPublishContract.View {

    @BindView(R.id.toolbar_back)
    RelativeLayout toolbarBack;
    @BindView(R.id.toolbar_title)
    TextView toolbarTitle;
    @BindView(R.id.back_right_icon)
    ImageView backRightIcon;
    @BindView(R.id.back_right_txt)
    TextView backRightTxt;
    @BindView(R.id.toolbar_right)
    RelativeLayout toolbarRight;
    @BindView(R.id.toolbar)
    AutoToolbar toolbar;
    @BindView(R.id.housepublishpublish_conten_camer_img)
    ImageView housepublishpublishContenCamerImg;
    @BindView(R.id.housepublishpublish_conten_noImg_lay)
    LinearLayout housepublishpublishContenNoImgLay;
    @BindView(R.id.housepublishpublish_conten_img)
    ImageView housepublishpublishContenImg;
    @BindView(R.id.housepublishpublish_conten_xqmc_txt)
    XEditText housepublishpublishContenXqmcTxt;
    @BindView(R.id.housepublishpublish_conten_szqy_txt)
    TextView housepublishpublishContenSzqyTxt;
    @BindView(R.id.housepublishpublish_conten_jtdz_txt)
    EditText housepublishpublishContenJtdzTxt;
    @BindView(R.id.housepublishpublish_conten_mj_txt)
    XEditText housepublishpublishContenMjTxt;
    @BindView(R.id.housepublishpublish_conten_lc_txt)
    TextView housepublishpublishContenLcTxt;
    @BindView(R.id.housepublishpublish_conten_hx_txt)
    TextView housepublishpublishContenHxTxt;
    @BindView(R.id.housepublishpublish_conten_zj_title_txt)
    TextView housepublishpublishContenZjTitleTxt;
    @BindView(R.id.housepublishpublish_conten_rzj_txt)
    XEditText housepublishpublishContenRzjTxt;
    @BindView(R.id.housepublishpublish_conten_yj_txt)
    TextView housepublishpublishContenYjTxt;
    @BindView(R.id.housepublishpublish_conten_lxr_txt)
    EditText housepublishpublishContenLxrTxt;
    @BindView(R.id.housepublishpublish_conten_man_txt)
    TextView housepublishpublishContenManTxt;
    @BindView(R.id.housepublishpublish_conten_woman_txt)
    TextView housepublishpublishContenWomanTxt;


    @BindView(R.id.HousePublishDuanZuPublish_next_txt)
    TextView HousePublishDuanZuPublishNextTxt;
    @BindView(R.id.HousePublishDuanZuPublish_next_lay)
    LinearLayout HousePublishDuanZuPublish_next_lay;


    @BindView(R.id.housepublishpublish_conten_fkfs_txt)
    TextView housepublishpublishContenFkfsTxt;
    @BindView(R.id.housepublishpublish_conten_fkfs_view)
    View housepublishpublishContenFkfsView;
    @BindView(R.id.housepublishpublish_conten_fkfs_lay)
    LinearLayout housepublishpublishContenFkfsLay;

    @BindView(R.id.housepublishpublish_conten_lx_view)
    View housepublishpublishContenLxView;
    @BindView(R.id.housepublishpublish_conten_lx_txt)
    TextView housepublishpublishContenLxTxt;
    @BindView(R.id.housepublishpublish_conten_lx_lay)
    LinearLayout housepublishpublishContenLxLay;
    @BindView(R.id.toolbar_backImg)
    ImageView toolbarBackImg;
    @BindView(R.id.housepublishpublish_conten_zx_txt)
    TextView housepublishpublishContenZxTxt;
    @BindView(R.id.housepublishpublish_conten_zx_lay)
    LinearLayout housepublishpublishContenZxLay;
    @BindView(R.id.housepublishpublish_conten_gsdp_txt)
    TextView housepublishpublishContenGsdpTxt;
    @BindView(R.id.housepublishpublish_gsdp_lay)
    LinearLayout housepublishpublishGsdpLay;
    @BindView(R.id.housepublishpublish_conten_gsdp_view)
    View housepublishpublishContenGsdpView;
    @BindView(R.id.Mystory_addStory_PhoneSsqy_txt)
    TextView MystoryAddStoryPhoneSsqyTxt;
    @BindView(R.id.Mystory_addStory_lxdh)
    EditText MystoryAddStoryLxdh;
    @BindView(R.id.housepublishpublish_conten_wxh_txt)
    EditText housepublishpublishContenWxhTxt;
    @BindView(R.id.housepublishpublish_conten_fwlx_txt)
    TextView housepublishpublishContenFwlxTxt;
    @BindView(R.id.housepublishpublish_conten_fwlx_lay)
    LinearLayout housepublishpublishContenFwlxLay;
    @BindView(R.id.housepublishpublish_conten_fwlx_view)
    View housepublishpublishContenFwlxView;

    private String sex = "男";

    private String room = "";//房间
    private String drawing = "";//客厅
    private String toilet = "";//卫生间
    private List<HousePayWayBean> houseArea;//区域
    private List<HousePayWayBean> mhousePayWayBeans;//支付方式
    private List<HousePayWayBean> duanZuLx;//短租类型
    private List<HousePayWayBean> househx_s;//户型室
    private List<HousePayWayBean> househx_t;//户型厅
    private List<HousePayWayBean> househx_w;//户型卫
    private List<HousePayWayBean> houseyj;//押金getHouseArea
    private List<HousePayWayBean> housezx;//房屋装修
    private List<HousePayWayBean> houselc;//楼层
    private List<HousePayWayBean> housezlc;//总楼层
    private HousePayWayBean selectSecond;//选中的区域
    private List<HousePayWayBean> housezfwlx;//房屋类型
    private int selectIndexfwlx,selectIndexQy, selectIndexZf, selectIndexLx, selectIndexYj, selectIndexZX, selectIndexLCDQ, selectIndexLCZS,
            selectIndexHx_s, selectIndexHx_t, selectIndexHx_w;
    private String selectLat, selectLng;
    private UserSfBean muserSfBean;//当前身份对象
    private List<ImgBean> imgBeans = new ArrayList<>();//上传图片地址封装
    private String landlordMobile = "";//房东手机号码
    private String isVerify = "0";
    ImageLoader glideImage;
    HousePublicBean housePublicBean = new HousePublicBean();
    List<MyStoryBean.ResultBean> mresultBeans;
    MyStoryBean.ResultBean selectResultBean;
    HousePayWayBean housePayWayBean;//发布类型，上一个页面传过来的
    @Override
    public void setupActivityComponent(@NonNull AppComponent appComponent) {
        DaggerHousePublishDuanZuPublishComponent //如找不到该类,请编译一下项目
                .builder()
                .appComponent(appComponent)
                .view(this)
                .build()
                .inject(this);
    }

    @Override
    public int initView(@Nullable Bundle savedInstanceState) {
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        return R.layout.activity_house_publish_duan_zu_publish; //如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0
    }

    @Override
    public void initData(@Nullable Bundle savedInstanceState) {
        housepublishpublishContenJtdzTxt.setText("测试机");
        housePublicBean.setAddressDetail("测试机哦");
        housePublicBean.setLgt("102.045");
        housePublicBean.setLat("25.1545");

        toolbar.setBackgroundColor(ArmsUtils.getColor(this, R.color.color_EDEDED));
        setmanButtonStatus(true);
        housepublishpublishContenXqmcTxt.setOnFocusChangeListener(new View.OnFocusChangeListener() {
            @Override
            public void onFocusChange(View v, boolean hasFocus) {
                if (hasFocus) {
                    // 获得焦点
                    HousePublishDuanZuPublish_next_lay.setVisibility(View.GONE);
                } else {
                    // 失去焦点
                    HousePublishDuanZuPublish_next_lay.setVisibility(View.VISIBLE);
                }
            }
        });
        HousePublishDuanZuPublishNextTxt.setBackgroundResource(R.drawable.button_yellow_bg);
        HousePublishDuanZuPublishNextTxt.setTextColor(ArmsUtils.getColor(HousePublishDuanZuPublishActivity.this, R.color.color_191919));

        if (getIntent().hasExtra("rentId"))
        {
            //编辑进来的
            mPresenter.viewHouseRent(getIntent().getStringExtra("rentId"));
            return;
        }
        if (getIntent().hasExtra("MyStoryBeanResultBean")){
            selectResultBean = (MyStoryBean.ResultBean)getIntent().getSerializableExtra("MyStoryBeanResultBean");
            housepublishpublishContenGsdpTxt.setText(selectResultBean.getStoreName());
            //从店铺里跳转过来
        }
        if (!TextUtils.isEmpty(housePublicBean.getLat())&&!TextUtils.isEmpty(housePublicBean.getLgt()))
        {
            housepublishpublishContenJtdzTxt.setFocusable(true);
        }  else {
            housepublishpublishContenJtdzTxt.setFocusable(false);
        }
        housePayWayBean=(HousePayWayBean)getIntent().getSerializableExtra("HousePayWayBean");
        if (glideImage == null) {
            glideImage = ArmsUtils.obtainAppComponentFromContext(this).imageLoader();
        }
        HideKey.initialize(this);
        UserBean userBean = DataHelper.getDeviceData(this, AppConstant.USER_INFO);
        if (userBean != null) {
            landlordMobile = userBean.getMobile();
        }
        if (userBean != null && userBean.getMobile() != null && userBean.getMobile().length() > 2) {
            MystoryAddStoryLxdh.setText(userBean.getMobile().substring(2, userBean.getMobile().length()));
            if (MystoryAddStoryLxdh.getText().toString().length() > 1 && "1".equals(MystoryAddStoryLxdh.getText().toString().substring(0, 1))) {
                MystoryAddStoryPhoneSsqyTxt.setText("+86");
            } else {
                MystoryAddStoryPhoneSsqyTxt.setText("+63");
            }
        }
        if (getIntent().getStringExtra("type").equals("dz"))
        {
            housepublishpublishContenFwlxLay.setVisibility(View.VISIBLE);
            housepublishpublishContenFwlxView.setVisibility(View.VISIBLE);
            //获取房屋类型，只有合租的时候有
//            mPresenter.getHousePayWayBean(Api.HOUSE_TYPE, "", housezfwlx);
        }else {
            housepublishpublishContenFwlxLay.setVisibility(View.GONE);
            housepublishpublishContenFwlxView.setVisibility(View.GONE);
        }

        //获取室厅卫
        mPresenter.getHousePayWayBean(Api.ROOM_COUNT, "", househx_s);
        mPresenter.getHousePayWayBean(Api.DRAWING_COUNT, "", househx_t);
        mPresenter.getHousePayWayBean(Api.TOILET_COUNT, "", househx_w);
        //获取店铺
        mPresenter.querySelectStory();

        //获取当前楼层
        mPresenter.getHousePayWayBean(Api.FLOOR, "", houselc);
        //获取总楼层
        mPresenter.getHousePayWayBean(Api.TOTAL_FLOOR, "", housezlc);
    }

    @Override
    public String reSetTitle() {
        if ("zz".equals(getIntent().getStringExtra("type"))) {
            housepublishpublishContenZjTitleTxt.setText(ArmsUtils.getString(this,R.string.housepublishpublish_month_rent_money));
            housepublishpublishContenLxView.setVisibility(View.GONE);
            housepublishpublishContenLxLay.setVisibility(View.GONE);

            return ArmsUtils.getString(this, R.string.housepublishpublish_title_zz);
        } else if ("dz".equals(getIntent().getStringExtra("type"))) {
            housepublishpublishContenZjTitleTxt.setText(R.string.housepublishpublish_day_rent_money);
            housepublishpublishContenFkfsView.setVisibility(View.GONE);
            housepublishpublishContenFkfsLay.setVisibility(View.GONE);
            housepublishpublishContenLxView.setVisibility(View.GONE);
            housepublishpublishContenLxLay.setVisibility(View.GONE);
            return ArmsUtils.getString(this, R.string.housepublishpublish_title_dz);
        } else if ("hz".equals(getIntent().getStringExtra("type"))){
            housepublishpublishContenZjTitleTxt.setText(ArmsUtils.getString(this,R.string.housepublishpublish_month_rent_money));
            housepublishpublishContenLxView.setVisibility(View.VISIBLE);
            housepublishpublishContenLxLay.setVisibility(View.VISIBLE);
            return ArmsUtils.getString(this, R.string.housepublishpublish_title_hz);
        }else {
            housepublishpublishContenZjTitleTxt.setText(ArmsUtils.getString(this,R.string.housepublishpublish_month_rent_money));
            housepublishpublishContenLxView.setVisibility(View.GONE);
            housepublishpublishContenLxLay.setVisibility(View.GONE);
            return ArmsUtils.getString(this, R.string.housepublishpublish_title_bs);
        }

    }

    @Override
    public void showLoading() {
        loadingDialog.show();
    }

    @Override
    public void hideLoading() {
        loadingDialog.dismiss();
    }

    @Override
    public void showMessage(@NonNull String message) {
        checkNotNull(message);
        ArmsUtils.snackbarText(message);
    }

    @Override
    public void launchActivity(@NonNull Intent intent) {
        checkNotNull(intent);
        ArmsUtils.startActivity(intent);
    }

    @Override
    public void killMyself() {
        finish();
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }

    @OnClick({R.id.housepublishpublish_conten_fwlx_txt,R.id.housepublishpublish_conten_lc_txt, R.id.Mystory_addStory_PhoneSsqy_txt, R.id.housepublishpublish_conten_zx_txt, R.id.housepublishpublish_conten_gsdp_txt, R.id.housepublishpublish_conten_lx_txt, R.id.housepublishpublish_conten_fkfs_txt, R.id.housepublishpublish_conten_camer_img, R.id.housepublishpublish_conten_img, R.id.housepublishpublish_conten_szqy_txt, R.id.housepublishpublish_conten_jtdz_txt, R.id.housepublishpublish_conten_hx_txt, R.id.housepublishpublish_conten_zj_title_txt, R.id.housepublishpublish_conten_rzj_txt, R.id.housepublishpublish_conten_yj_txt, R.id.housepublishpublish_conten_lxr_txt, R.id.housepublishpublish_conten_man_txt, R.id.housepublishpublish_conten_woman_txt, R.id.HousePublishDuanZuPublish_next_txt})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.housepublishpublish_conten_fwlx_txt:
                 //短租房屋类型
                mPresenter.getHousePayWayBean(Api.RENT_ROOM, housePayWayBean.getCategory(), housezfwlx);
                break;
            case R.id.Mystory_addStory_PhoneSsqy_txt:
                //号码切换
                showPopuWindow();
                break;
            case R.id.housepublishpublish_conten_lx_txt:
                //合租时候获取类型
                mPresenter.getHousePayWayBean(Api.RENT_ROOM, housePayWayBean.getCategory(), duanZuLx);
                break;
            case R.id.housepublishpublish_conten_fkfs_txt:
                //付款方式
                mPresenter.getHousePayWayBean(Api.DAY_RENT, getIntent().getStringExtra("type"), mhousePayWayBeans);
                break;
            case R.id.housepublishpublish_conten_camer_img:
                //选择图片
                Intent intent = new Intent(this, HousePushUpdateImgActivity.class);
                intent.putExtra("type", "selectImg");
                ArmsUtils.startActivityForResult(intent, AppConstant.START_ACTIVITY_REQUEST_CODE);
                break;
            case R.id.housepublishpublish_conten_img:
                if(imgBeans==null||imgBeans.isEmpty()){
                    Intent intent5 = new Intent(this, HousePushUpdateImgActivity.class);
                    intent5.putExtra("type", "selectImg");
                    ArmsUtils.startActivityForResult(intent5, AppConstant.START_ACTIVITY_REQUEST_CODE);
                    return;
                }
                //修改封面图
                Intent intent3 = new Intent(this, HousePushUpdateImgActivity.class);
                if (imgBeans!=null)
                {
                    intent3.putExtra("imgs", (Serializable) imgBeans);
                }else {
                    intent3.putExtra("type", "selectImg");
                }
                ArmsUtils.startActivityForResult(intent3, AppConstant.START_ACTIVITY_REQUEST_CODE);
                break;
            case R.id.housepublishpublish_conten_szqy_txt:
                //所在区域
                mPresenter.getHouseArea(Api.HOUSE_AREA, houseArea);

                break;
            case R.id.housepublishpublish_conten_jtdz_txt:
                if (houseArea == null || houseArea.size() < 1) {
                    showMessage("请先选择所在区域");
                    return;
                }
                //具体地址
                Intent intentMap = new Intent(this, MapSelectAddressActivity.class);
                intentMap.putExtra("selectedAreaName", selectSecond.getName());
                intentMap.putExtra("lat",selectSecond.getLat());
                intentMap.putExtra("lng",selectSecond.getLgt());
                startActivityForResult(intentMap, 1004);
                break;
            case R.id.housepublishpublish_conten_hx_txt:
                if (househx_s == null) {
                    mPresenter.getHousePayWayBean(Api.ROOM_COUNT, "", househx_s);
                    showMessage("未获取到户型数据，请重试");
                    return;
                }
                if (househx_t == null) {
                    mPresenter.getHousePayWayBean(Api.DRAWING_COUNT, "", househx_t);
                    showMessage("未获取到户型数据，请重试");
                    return;
                }
                if (househx_w == null) {
                    mPresenter.getHousePayWayBean(Api.TOILET_COUNT, "", househx_w);
                    showMessage("未获取到户型数据，请重试");
                    return;
                }
                //户型
                new MultiSelectPopWindow1.Builder(this)
                        .setConfirmListener(new MultiSelectPopWindow1.OnConfirmClickListener() {
                            @Override
                            public void onClick(MessageEvent messageEvent) {
                                room = messageEvent.getRoom();//房间
                                drawing = messageEvent.getDrawing();//客厅
                                toilet = messageEvent.getToilet();//卫生间
                                selectIndexHx_s = messageEvent.getRoomIndex();
                                selectIndexHx_t = messageEvent.getDrawingIndex();
                                selectIndexHx_w = messageEvent.getToiletIndex();
                                housepublishpublishContenHxTxt.setText(messageEvent.getRoom() + messageEvent.getDrawing() + messageEvent.getToilet());
                            }
                        })
                        .setDataArray(null)
                        .setisSetData(true)
                        .setFirstDataArray(mPresenter.getHousePayWay(househx_s))
                        .setSecondDataArray(mPresenter.getHousePayWay(househx_t))
                        .setThirdDataArray(mPresenter.getHousePayWay(househx_w))
                        .setCancel(ArmsUtils.getString(this, R.string.user_set_editinfo_cancel))
                        .setTitle(ArmsUtils.getString(this, R.string.dilaog_titile_xztssj_txt))
                        .setConfirm(ArmsUtils.getString(this, R.string.sure_txt))
                        .build()
                        .show(housepublishpublishContenHxTxt);
                break;
            case R.id.housepublishpublish_conten_zj_title_txt:
                break;
            case R.id.housepublishpublish_conten_rzj_txt:
                break;
            case R.id.housepublishpublish_conten_yj_txt:
                //选择押金方式
                mPresenter.getHousePayWayBean(Api.CASH_PLEDGE, "", houseyj);
//                mPresenter.showPopuWindow_selectYj(this, housepublishpublishContenYjTxt, housepublishpublishContenYjTxt.getText().toString());
                break;
            case R.id.housepublishpublish_conten_lxr_txt:
                break;
            case R.id.housepublishpublish_conten_man_txt:
                sex = "男";
                setmanButtonStatus(true);
                break;
            case R.id.housepublishpublish_conten_woman_txt:
                sex = "女";
                setmanButtonStatus(false);
                break;


            case R.id.HousePublishDuanZuPublish_next_txt:
                if (imgBeans == null || imgBeans.isEmpty()) {
                    showMessage("请选择房屋图片");
                    return;
                }

                if (getIntent().getStringExtra("type").equals("dz"))
                {
                    if (StringUtils.ViewisEnpty(housepublishpublishContenFwlxTxt))
                    {
                        showMessage("请选择房屋类型");
                        return;
                    }
                }
                if (TextUtils.isEmpty(MystoryAddStoryLxdh.getText().toString()) || MystoryAddStoryLxdh.getText().toString().length() < 1) {
                    showMessage("请输入联系电话");
                    return;
                }
                if (MystoryAddStoryPhoneSsqyTxt.getText().toString().equals("+63")) {
                    if (MystoryAddStoryLxdh.getText().toString().substring(0, 1).equals("0")) {
                        showMessage("手机号不能是0开头");
                        return;
                    }
                    if (!MystoryAddStoryLxdh.getText().toString().substring(0, 1).equals("9")) {
                        showMessage("手机号必须是9开头");
                        return;
                    }
                    if (MystoryAddStoryLxdh.getText().toString().length() != 10) {
                        showMessage("手机号长度必须是十位");
                        return;
                    }
                } else {
                    if (MystoryAddStoryLxdh.getText().toString().length() != 11) {
                        showMessage("手机号必须是11位");
                        return;
                    }
                    if (!MystoryAddStoryLxdh.getText().toString().substring(0, 1).equals("1")) {
                        showMessage("手机号格式有误");
                        return;
                    }
                }
                if (StringUtils.ViewisEnpty(housepublishpublishContenXqmcTxt)) {
                    showMessage("请填写小区名称");
                    return;
                }

                if (StringUtils.ViewisEnpty(housepublishpublishContenSzqyTxt) || houseArea == null) {
                    showMessage("请选择所在区域");
                    return;
                }
                if (StringUtils.ViewisEnpty(housepublishpublishContenJtdzTxt)) {
                showMessage("请选择具体地址");
                return;
            }
                if (StringUtils.ViewisEnpty(housepublishpublishContenMjTxt)) {
                    showMessage("请填写面积");
                    return;
                }
                if (StringUtils.ViewisEnpty(housepublishpublishContenLcTxt)) {
                    showMessage("请选择楼层");
                    return;
                }
                if (StringUtils.ViewisEnpty(housepublishpublishContenYjTxt)) {
                    showMessage("请选择押金");
                    return;
                }
                if (StringUtils.ViewisEnpty(housepublishpublishContenLxrTxt)) {
                    showMessage("请输入联系人");
                    return;
                }
                  if (StringUtils.ViewisEnpty(housepublishpublishContenLcTxt))
                  {
                      showMessage("请选择楼层");
                      return;
                  }

                //详细地址从地图选择，先填写一个默认的
                housePublicBean.setRentType(housePayWayBean.getCategory());
                housePublicBean.setRentRoom("");

                    if (!"dz".equals(getIntent().getStringExtra("type"))) {
                    //非短租情况下有付款方式
                    if (StringUtils.ViewisEnpty(housepublishpublishContenFkfsTxt)) {
                        showMessage("请选择付款方式");
                        return;
                    }
                        housePublicBean.setDayRent(mhousePayWayBeans.get(selectIndexZf).getDictId());
                }

                if ("hz".equals(getIntent().getStringExtra("type"))) {
                    //只有合租有房间类型
                    housePublicBean.setRentRoom(duanZuLx.get(selectIndexLx).getDictId());

                    if (StringUtils.ViewisEnpty(housepublishpublishContenLxTxt)) {
                        showMessage("请选择房间类型");
                        return;
                    }
                }
                if (selectIndexLCDQ>-1&&selectIndexLCZS>-1&&!getIntent().getStringExtra("type").equals("bs")&&Integer.parseInt(houselc.get(selectIndexLCDQ).getAliasName()) > Integer.parseInt(housezlc.get(selectIndexLCZS).getAliasName())) {
                    showMessage("当前楼层不能大于总楼层");
                    return;
                }
                if (mresultBeans!=null&&!mresultBeans.isEmpty())
                {
                    if (selectResultBean==null)
                    {
                        showMessage("请选择所属店铺");
                        return;
                    }
                    housePublicBean.setUserStoreId(selectResultBean.getStoreId());
                }

                housePublicBean.setHouseName(housepublishpublishContenXqmcTxt.getText().toString().trim());
//                housePublicBean.setHouseArea(!TextUtils.isEmpty(toilet) ? toilet : (TextUtils.isEmpty(drawing) ? drawing : room));

                //区域houseArea
                if (selectSecond!=null){
                    housePublicBean.setHouseArea(selectSecond.getDictId());
                }


                housePublicBean.setAcreage(housepublishpublishContenMjTxt.getText().toString().trim());
                if (selectIndexLCDQ!=-1&&houselc!=null&&!houselc.isEmpty())
                {
                    housePublicBean.setFloor(houselc.get(selectIndexLCDQ).getDictId());
                }

                if (selectIndexLCZS!=-1&&housezlc!=null&&!housezlc.isEmpty())
                {
                    housePublicBean.setTotalFloor(housezlc.get(selectIndexLCZS).getDictId());
                }

                housePublicBean.setMonthRent(Double.parseDouble(housepublishpublishContenRzjTxt.getText().toString().trim()));

                if (!"dz".equals(getIntent().getStringExtra("type"))) {
                    //短租没有支付方式
                    housePublicBean.setDayRent(mhousePayWayBeans.get(selectIndexZf).getDictId());
                }
                if (househx_s == null || selectIndexHx_s == -1) {
                    mPresenter.getHousePayWayBean(Api.ROOM_COUNT, "", househx_s);
                    showMessage("未选择户型");
                    return;
                }
                if (househx_t == null || selectIndexHx_t == -1) {
                    mPresenter.getHousePayWayBean(Api.DRAWING_COUNT, "", househx_t);
                    showMessage("未选择户型");
                    return;
                }
                if (househx_w == null || selectIndexHx_w == -1) {
                    mPresenter.getHousePayWayBean(Api.TOILET_COUNT, "", househx_w);
                    showMessage("未选择户型");
                    return;
                }
                if (housepublishpublishContenZxTxt.getText().toString().trim().length() < 1) {
                    showMessage("请选择房屋装修");
                    return;
                }

                if (housePublicBean.getLat()==null||housePublicBean.getLgt()==null||TextUtils.isEmpty(housePublicBean.getLgt())||TextUtils.isEmpty(housePublicBean.getLat()))
                {
                    showMessage("未获取到经纬度，请重新选择地址");
                    return;
                }
                housePublicBean.setLandlordMobile(MystoryAddStoryPhoneSsqyTxt.getText().toString().replace("+", "").trim() + MystoryAddStoryLxdh.getText().toString());
                housePublicBean.setWechatNumber(housepublishpublishContenWxhTxt.getText().toString().trim());
                housePublicBean.setDecorationType(housezx.get(selectIndexZX).getDictId());
                housePublicBean.setCashPledge(houseyj.get(selectIndexYj).getDictId());
                housePublicBean.setLandlord(housepublishpublishContenLxrTxt.getText().toString().trim());
                housePublicBean.setLandlordGender(sex);

                housePublicBean.setRoomCount(househx_s.get(selectIndexHx_s).getDictId());
                housePublicBean.setDrawingCount(househx_t.get(selectIndexHx_t).getDictId());
                housePublicBean.setToiletCoun(househx_w.get(selectIndexHx_w).getDictId());
                housePublicBean.setIsVerify(isVerify);
                housePublicBean.setHouseImage(imgBeans);
                housePublicBean.setAddressDetail(housepublishpublishContenJtdzTxt.getText().toString());
                Intent intent1 = new Intent(this, HousePublisInfoActivity.class);
                intent1.putExtra("type", getIntent().getStringExtra("type"));
                intent1.putExtra("HousePublicBean", housePublicBean);
                startActivityForResult(intent1, 1003);

                break;

            case R.id.housepublishpublish_conten_gsdp_txt:
                if (mresultBeans == null) {
                    return;
                }
                MemberCenterUserInfoBean memberCenterUserInfoBean = DataHelper.getDeviceData(this, AppConstant.user_memberInfo);
                mPresenter.popuwindSelectStore(this, housepublishpublishContenGsdpTxt, memberCenterUserInfoBean, mresultBeans, new HousePublishDuanZuPublishPresenter.SelectStoreCallback() {
                    @Override
                    public void callBack(MyStoryBean.ResultBean resultBean) {
                        housepublishpublishContenGsdpTxt.setText(resultBean.getStoreName());
                        selectResultBean = resultBean;
                    }
                });
                break;
            case R.id.housepublishpublish_conten_zx_txt:
                //装修
                mPresenter.getHousePayWayBean(Api.DECORATION_TYPE, "", housezx);
                break;
            case R.id.housepublishpublish_conten_lc_txt:
                //楼层
                if (houselc == null) {
                    mPresenter.getHousePayWayBean(Api.FLOOR, "", houselc);
                    return;
                }
                if (housezlc == null) {
                    mPresenter.getHousePayWayBean(Api.TOTAL_FLOOR, "", housezlc);
                    return;
                }

                HousePayWayBean temDzFwlx=null;
                if (getIntent().getStringExtra("type").equals("dz"))
                {

                    if (StringUtils.ViewisEnpty(housepublishpublishContenFwlxTxt))
                    {
                        showMessage("请选择房屋类型");
                        return;
                    }
                    temDzFwlx=housezfwlx.get(selectIndexfwlx);
                }


                //楼层
                new MultiSelectPopWindow1.Builder(this)
                        .setConfirmListener(new MultiSelectPopWindow1.OnConfirmClickListener() {
                            @Override
                            public void onClick(MessageEvent messageEvent) {

                                selectIndexLCDQ = messageEvent.getRoomIndex();//当前楼层
                                selectIndexLCZS = messageEvent.getDrawingIndex();//总楼层
                                if (getIntent().getStringExtra("type").equals("bs"))
                                {
                                    housepublishpublishContenLcTxt.setText(messageEvent.getRoom());
                                }else {
                                    housepublishpublishContenLcTxt.setText(messageEvent.getRoom() +(messageEvent.getDrawing()!=null?("/" + messageEvent.getDrawing()):""));
                                }
                            }
                        })
                        .setDataArray(null)
                        .setisSetData(true)
                        .setFirstDataArray((getIntent().getStringExtra("type").equals("bs")||(temDzFwlx!=null&&temDzFwlx.getName().equals("独栋别墅")))?mPresenter.getHousePayWay(housezlc):mPresenter.getHousePayWay(houselc))
                        .setSecondDataArray((getIntent().getStringExtra("type").equals("bs")||(temDzFwlx!=null&&temDzFwlx.getName().equals("独栋别墅")))?null:mPresenter.getHousePayWay(housezlc))
                        .setCancel(ArmsUtils.getString(this, R.string.user_set_editinfo_cancel))
                        .setTitle(ArmsUtils.getString(this, R.string.dilaog_titile_lc))
                        .setConfirm(ArmsUtils.getString(this, R.string.sure_txt))
                        .build()
                        .show(housepublishpublishContenHxTxt);


                break;
        }
    }

    /**
     * 你的身份
     */
    public void showDialog() {
        new AlertView(ArmsUtils.getString(this, R.string.dilaog_titile_titile_ts), "您还有" + (muserSfBean == null ? 3 : (3 - muserSfBean.getLevelChangeCount())) + "次修改身份的机会，请三思", ArmsUtils.getString(this, R.string.dilaog_titile_xg), new String[]{ArmsUtils.getString(this, R.string.dilaog_titile_qx)}, null, this, AlertView.Style.Alert, new AlertViewOnItemClickListener() {

            @Override
            public void onItemClick(Object o, int position) {
                if (position == AlertView.CANCELPOSITION) {
                    if ((muserSfBean == null ? 3 : (3 - muserSfBean.getLevelChangeCount())) < 1) {
                        showMessage("您修改身份频率过高，不能修改");
                        return;
                    }
                    //点击取消按钮,修改
//                    mPresenter.showPopuWindow_selectZy(HousePublishDuanZuPublishActivity.this, housepublishpublishContenNdsfTxt, housepublishpublishContenNdsfTxt.getText().toString());
//                    mPresenter.getApartmentRoom(Api.LANDLORD_TYPE, "", housesf);
                } else {
                    //取消
                }
            }
        }).show();
    }

    /**
     * 性别控制
     *
     * @param firstIsSelect
     */
    public void setmanButtonStatus(boolean firstIsSelect) {
        if (firstIsSelect) {
            //选中先生
            housepublishpublishContenManTxt.setBackgroundResource(R.drawable.halfleftbutton_yellow_bg);
            housepublishpublishContenManTxt.setTextColor(ArmsUtils.getColor(this, R.color.color_191919));
            housepublishpublishContenWomanTxt.setBackgroundResource(R.drawable.halfrightbutton_gray_bg);
            housepublishpublishContenWomanTxt.setTextColor(ArmsUtils.getColor(this, R.color.white));
        } else {
            //选中女士
            housepublishpublishContenManTxt.setBackgroundResource(R.drawable.halfleftbutton_gray_bg);
            housepublishpublishContenManTxt.setTextColor(ArmsUtils.getColor(this, R.color.white));
            housepublishpublishContenWomanTxt.setBackgroundResource(R.drawable.halfrightbutton_yellow_bg);
            housepublishpublishContenWomanTxt.setTextColor(ArmsUtils.getColor(this, R.color.color_191919));
        }
    }

    @Override
    public void showSf(String code, String data) {
        if (TextUtils.isEmpty(data)) {
            return;
        }
//        housepublishpublishContenNdsfTxt.setText(data);
    }

    @Override
    public void showYj(String code, String data) {
        if (TextUtils.isEmpty(data)) {
            return;
        }
        housepublishpublishContenYjTxt.setText(data);
    }

    @Override
    public void getHousePayWayBeanSuccess(List<HousePayWayBean> housePayWayBeans) {
        if (housePayWayBeans != null && !housePayWayBeans.isEmpty()) {
            if (Api.ROOM_COUNT.equals(housePayWayBeans.get(0).getValue()) || Api.DRAWING_COUNT.equals(housePayWayBeans.get(0).getValue()) ||
                    Api.TOILET_COUNT.equals(housePayWayBeans.get(0).getValue()) || Api.FLOOR.equals(housePayWayBeans.get(0).getValue()) || Api.TOTAL_FLOOR.equals(housePayWayBeans.get(0).getValue())) {
                if (Api.ROOM_COUNT.equals(housePayWayBeans.get(0).getValue())) {
                    househx_s = housePayWayBeans;
                } else if (Api.DRAWING_COUNT.equals(housePayWayBeans.get(0).getValue())) {
                    househx_t = housePayWayBeans;
                } else if (Api.FLOOR.equals(housePayWayBeans.get(0).getValue())) {
                    //当前楼层
                    houselc = housePayWayBeans;
                } else if (Api.TOTAL_FLOOR.equals(housePayWayBeans.get(0).getValue())) {
                    //总楼层
                    housezlc = housePayWayBeans;
                } else {
                    househx_w = housePayWayBeans;
                }

                return;
            }
            new MultiSelectPopWindow.Builder(this)
                    .setConfirmListener(new MultiSelectPopWindow.OnConfirmClickListener() {
                        @Override
                        public void onClick(MessageEvent messageEvent) {
                            switch (housePayWayBeans.get(0).getValue()) {
                                case Api.CASH_PLEDGE:
                                    //押金
                                    houseyj = housePayWayBeans;
                                    selectIndexYj = messageEvent.getSelectId();
                                    housepublishpublishContenYjTxt.setText(messageEvent.getSelectData());
                                    break;
                                case Api.DAY_RENT:
                                    //付款方式
                                    selectIndexZf = messageEvent.getSelectId();
                                    mhousePayWayBeans = housePayWayBeans;
                                    housepublishpublishContenFkfsTxt.setText(messageEvent.getSelectData());
                                    break;
                                case Api.RENT_ROOM:
                                    //合租房间类型
                                    selectIndexLx = messageEvent.getSelectId();
                                    duanZuLx = housePayWayBeans;
                                    housepublishpublishContenLxTxt.setText(messageEvent.getSelectData());

                                    selectIndexfwlx= messageEvent.getSelectId();
                                    housezfwlx= housePayWayBeans;
                                    housepublishpublishContenFwlxTxt.setText(messageEvent.getSelectData());

                                    break;
                                case Api.DECORATION_TYPE:
                                    //装修
                                    selectIndexZX =messageEvent.getSelectId();
                                    housezx = housePayWayBeans;
                                    housepublishpublishContenZxTxt.setText(messageEvent.getSelectData());
                                    break;

                            }
                        }
                    })
                    .setDataArray(mPresenter.getHousePayWay(housePayWayBeans))
                    .setCancel(ArmsUtils.getString(this, R.string.user_set_editinfo_cancel))
                    .setTitle(getDialogTitle(housePayWayBeans.get(0).getValue()))
                    .setConfirm(ArmsUtils.getString(this, R.string.sure_txt))
                    .build()
                    .show(housepublishpublishContenSzqyTxt);
        }
    }

    @Override
    public void getUserShopSuccess(UserSfBean userSfBean) {
        if (userSfBean != null && userSfBean.getShopName() != null) {
            this.muserSfBean = userSfBean;//记录用户当前身份
//            housepublishpublishContenNdsfTxt.setText(userSfBean.getShopName());
        }
    }

    @Override
    public void querySelectStorySuccess(List<MyStoryBean.ResultBean> resultBeans) {
        mresultBeans = resultBeans;
        if (mresultBeans == null || mresultBeans.isEmpty() || mresultBeans.size() == 1) {
            housepublishpublishGsdpLay.setVisibility(View.GONE);
            housepublishpublishContenGsdpView.setVisibility(View.GONE);
            if (mresultBeans != null && mresultBeans.size() == 1&&!getIntent().hasExtra("MyStoryBeanResultBean")) {
                housepublishpublishContenGsdpTxt.setText(mresultBeans.get(0).getStoreName());
                selectResultBean = mresultBeans.get(0);
            }

        } else {
            housepublishpublishGsdpLay.setVisibility(View.VISIBLE);
            housepublishpublishContenGsdpView.setVisibility(View.VISIBLE);
        }

    }

    @Override
    public void viewHouseRentSuccess(HouseRentListShowInfoBean houseRentListShowInfoBean) {
        housepublishpublishContenJtdzTxt.setText(houseRentListShowInfoBean.getAddressDetail());
        housePublicBean.setAddressDetail(houseRentListShowInfoBean.getAddressDetail());
        housePublicBean.setLgt(houseRentListShowInfoBean.getLgt());
        housePublicBean.setLat(houseRentListShowInfoBean.getLat());
        housePublicBean.setHouseName(houseRentListShowInfoBean.getHouseName());
        housePublicBean.setRentType(houseRentListShowInfoBean.getRentType());
        if (houseRentListShowInfoBean.getHouseAreaName() != null && !houseRentListShowInfoBean.getHouseAreaName().isEmpty()) {
           String temName="";
            for (int i = 0; i < houseRentListShowInfoBean.getHouseAreaName().size(); i++) {
                if (i ==houseRentListShowInfoBean.getHouseAreaName().size()-1) {
                    temName += houseRentListShowInfoBean.getHouseAreaName().get(i).getName() + ".";
                } else {
                    temName += houseRentListShowInfoBean.getHouseAreaName().get(i).getName();
                }
                if (i ==houseRentListShowInfoBean.getHouseAreaName().size()-1) {
                    housePublicBean.setHouseArea(houseRentListShowInfoBean.getHouseAreaName().get(i).getDictId());
                }
            }
            housepublishpublishContenSzqyTxt.setText(temName);
        }
       selectSecond=new HousePayWayBean();
        selectSecond.setName(houseRentListShowInfoBean.getHouseAreaName().get(1).getName());
        selectSecond.setDictId(houseRentListShowInfoBean.getHouseAreaName().get(1).getDictId());

        housePublicBean.setAcreage(houseRentListShowInfoBean.getAcreage()+"");
        housePublicBean.setFloor(houseRentListShowInfoBean.getFloor());
        housePublicBean.setTotalFloor(houseRentListShowInfoBean.getTotalFloor());
        housePublicBean.setMonthRent(houseRentListShowInfoBean.getMonthRent().doubleValue());
        housePublicBean.setDayRent(houseRentListShowInfoBean.getDayRent());
        housePublicBean.setCashPledge(houseRentListShowInfoBean.getCashPledge());
        housePublicBean.setLandlord(houseRentListShowInfoBean.getLandlord());
        housePublicBean.setLandlordGender(houseRentListShowInfoBean.getLandlordGender());
        housePublicBean.setLandlordMobile(houseRentListShowInfoBean.getLandlordMobile());
        housePublicBean.setDetail(houseRentListShowInfoBean.getDetail());
        housePublicBean.setRoomCount(houseRentListShowInfoBean.getRoomCount());
        housePublicBean.setDrawingCount(houseRentListShowInfoBean.getDrawingCount());
        housePublicBean.setToiletCoun(houseRentListShowInfoBean.getToiletCount());
        housePublicBean.setIsVerify(houseRentListShowInfoBean.getIsVerify()+"");
        housePublicBean.setRentRoom(houseRentListShowInfoBean.getRentRoom());
//        housePublicBean.setHouseImage(houseRentListShowInfoBean.getHouseImageList());
        housePublicBean.setDetail(houseRentListShowInfoBean.getDetail());
        housePublicBean.setHouse_category(houseRentListShowInfoBean.getHouseCategory());
        housePublicBean.setUserStoreId(houseRentListShowInfoBean.getUserStoreId());
        housePublicBean.setToFloor(houseRentListShowInfoBean.getToFloor());
        housePublicBean.setDecorationType(houseRentListShowInfoBean.getDecorationType());
        housePublicBean.setAccommodationStation(houseRentListShowInfoBean.getAccommodationStation()+"");
        housePublicBean.setResidueLeaseUnit(houseRentListShowInfoBean.getResidueLeaseUnit());
        housePublicBean.setCurrentStatus(houseRentListShowInfoBean.getCurrentStatus());
        housePublicBean.setOriginalBusiness(houseRentListShowInfoBean.getOriginalBusiness());
        housePublicBean.setWechatNumber(houseRentListShowInfoBean.getWechatNumber());
        housePublicBean.setIsSeparable(houseRentListShowInfoBean.getIsSeparable()+"");
        housePublicBean.setIsOfficeAppliances(houseRentListShowInfoBean.getIsOfficeAppliances()+"");
        housePublicBean.setTransferFee(houseRentListShowInfoBean.getTransferFee()+"");
        housePublicBean.setResidueLease(houseRentListShowInfoBean.getResidueLease()+"");
        housePublicBean.setDailyRent(houseRentListShowInfoBean.getDailyRent().doubleValue()+"");
        housePublicBean.setTransferOrLease(houseRentListShowInfoBean.getTransferOrLease());
//        String transferOrLease;//转让或者出租 转让：transfer 出租：lease
          if (houseRentListShowInfoBean.getHouseImageList()!=null&&!houseRentListShowInfoBean.getHouseImageList().isEmpty())
          {
              for (HouseRentListShowInfoBean.HouseImageListBean houseImageListBean:houseRentListShowInfoBean.getHouseImageList())
              {
                  imgBeans.add(new ImgBean(houseImageListBean.getImageUrl(),houseImageListBean.getImageType()));
              }
              glideImage.loadImage(HousePublishDuanZuPublishActivity.this, ImageConfigImpl.builder().url(imgBeans.get(0).getImageUrl()).imageRadius(5)
                      .imageView(housepublishpublishContenImg)
                      .build());
          }
          if (houseRentListShowInfoBean.getRentType().equals("dz"))
          {
              //短租获取房屋类型
              mPresenter.getHousePayWayBean(Api.RENT_ROOM, housePayWayBean.getCategory(), housezfwlx);

              //房屋类型
              housepublishpublishContenFwlxLay.setVisibility(View.VISIBLE);
              housepublishpublishContenFwlxView.setVisibility(View.VISIBLE);
              housepublishpublishContenFwlxTxt.setText(houseRentListShowInfoBean.getRentRoomName());

          }else {
              housepublishpublishContenFwlxLay.setVisibility(View.GONE);
              housepublishpublishContenFwlxView.setVisibility(View.GONE);
          }
          housepublishpublishContenXqmcTxt.setText(houseRentListShowInfoBean.getHouseName());
          housepublishpublishContenJtdzTxt.setText(houseRentListShowInfoBean.getAddressDetail());
        housepublishpublishContenJtdzTxt.setFocusable(true);
        housepublishpublishContenMjTxt.setText(houseRentListShowInfoBean.getAcreage()+"");
        housepublishpublishContenHxTxt.setText(houseRentListShowInfoBean.getRentRoomName()+houseRentListShowInfoBean.getToiletCountName()+houseRentListShowInfoBean.getDrawingCountName());
        housepublishpublishContenZxTxt.setText(houseRentListShowInfoBean.getDecorationTypeName());
       String temZcName="";
       if (houseRentListShowInfoBean.getFloorName()!=null&&TextUtils.isEmpty(houseRentListShowInfoBean.getFloorName()))
       {
           temZcName+=temZcName;
       }
        if (houseRentListShowInfoBean.getToFloorName()!=null&&TextUtils.isEmpty(houseRentListShowInfoBean.getToFloorName()))
        {
            if (!TextUtils.isEmpty(temZcName))
            {
                temZcName+=("-"+temZcName);
            }else {
                temZcName+=temZcName;
            }

        }
        if (houseRentListShowInfoBean.getTotalFloorName()!=null&&TextUtils.isEmpty(houseRentListShowInfoBean.getTotalFloorName()))
        {
            if (!TextUtils.isEmpty(temZcName))
            {
                temZcName+=("/"+temZcName);
            }else {
                temZcName+=temZcName;
            }
        }
        housepublishpublishContenLcTxt.setText(temZcName);
        housepublishpublishContenRzjTxt.setText(houseRentListShowInfoBean.getMonthRent().intValue()+"");
        housepublishpublishContenYjTxt.setText(houseRentListShowInfoBean.getCashPledgeName());
        housepublishpublishContenLxrTxt.setText(houseRentListShowInfoBean.getLandlord());
        sex=houseRentListShowInfoBean.getLandlordGender();
        if (sex.equals("男"))
        {
            setmanButtonStatus(true);
        }else {
            setmanButtonStatus(false);
        }
        if (houseRentListShowInfoBean.getLandlordMobile().substring(2,houseRentListShowInfoBean.getLandlordMobile().length()).substring(0,1).equals("1"))
        {
            MystoryAddStoryPhoneSsqyTxt.setText("+86");
        }else {
            MystoryAddStoryPhoneSsqyTxt.setText("+63");
        }
        MystoryAddStoryLxdh.setText(houseRentListShowInfoBean.getLandlordMobile().substring(2,houseRentListShowInfoBean.getLandlordMobile().length()));
        housepublishpublishContenWxhTxt.setText(houseRentListShowInfoBean.getWechatNumber());

    }

    /**
     * 根据类型动态设置标题
     *
     * @param value
     * @return
     */
    public String getDialogTitle(String value) {
        String temTitle = "";
        switch (value) {
            case Api.CASH_PLEDGE:
                //押金
                temTitle = ArmsUtils.getString(HousePublishDuanZuPublishActivity.this, R.string.housepublishpublish_info_title_yj);
                break;
            case Api.DAY_RENT:
                //付款方式
                temTitle = ArmsUtils.getString(HousePublishDuanZuPublishActivity.this, R.string.housepublishpublish_title_fkfs);
                break;
            case Api.RENT_ROOM:
                //合租房间类型       //房屋类型、短租
                if (housePayWayBean.getCategory().equals("hz"))
                {
                    temTitle = ArmsUtils.getString(HousePublishDuanZuPublishActivity.this, R.string.housepublishpublish_title_fjlx);
                }else {
                    temTitle = ArmsUtils.getString(HousePublishDuanZuPublishActivity.this, R.string.housepublishpublish_title_fwlx);
                }

                break;
            case Api.LANDLORD_TYPE:
                //您的身份
                temTitle = ArmsUtils.getString(HousePublishDuanZuPublishActivity.this, R.string.housepublishpublish_title_ndsf);
                break;
            case Api.FLOOR:
                //楼层
                temTitle = ArmsUtils.getString(HousePublishDuanZuPublishActivity.this, R.string.housepublishpublish_title_lc);
                break;
            case Api.DECORATION_TYPE:
                //楼层
                temTitle = ArmsUtils.getString(HousePublishDuanZuPublishActivity.this, R.string.housepublishpublish_title_qxzfwzx);
                break;

        }
        return temTitle;
    }

    @Override
    public void addHouseRentSuccess() {

    }

    @Override
    public void sendHouseVerifyCodeSuccess() {

    }

    @Override
    public void houseCheckIsCorrectCodeSuccess() {

    }

    @Override
    public void getHouseArea(List<HousePayWayBean> housePayWayBeans) {
        this.houseArea = housePayWayBeans;
        new MultiSelectPopWindow1.Builder(this)
                .setConfirmListener(new MultiSelectPopWindow1.OnConfirmClickListener() {
                    @Override
                    public void onClick(MessageEvent messageEvent) {
                        selectIndexQy =messageEvent.getSelectId();
                        //所在区域
                        housepublishpublishContenSzqyTxt.setText(messageEvent.getRoom() + (messageEvent.getDrawing() != null ? messageEvent.getDrawing() : "") + (messageEvent.getToilet() != null ? messageEvent.getToilet() : ""));
                        room = messageEvent.getRoom();
                        drawing = messageEvent.getDrawing();
                        toilet = messageEvent.getToilet();
                        selectSecond = houseArea.get(messageEvent.getRoomIndex()).getChildren().get(messageEvent.getDrawingIndex());

                    }
                })
                .setDataArray(housePayWayBeans)
                .setCancel(ArmsUtils.getString(this, R.string.user_set_editinfo_cancel))
                .setTitle(ArmsUtils.getString(this, R.string.dilaog_titile_xzszqy_txt))
                .setConfirm(ArmsUtils.getString(this, R.string.sure_txt))
                .build()
                .show(housepublishpublishContenSzqyTxt);
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (data != null && resultCode == RESULT_OK) {
            if (requestCode == AppConstant.START_ACTIVITY_REQUEST_CODE) {
                //选择图片回来
                housepublishpublishContenNoImgLay.setVisibility(View.GONE);
                imgBeans = (List<ImgBean>) data.getSerializableExtra("imgs");
                if (imgBeans != null && !imgBeans.isEmpty()) {
                    housepublishpublishContenImg.postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            glideImage.loadImage(HousePublishDuanZuPublishActivity.this, ImageConfigImpl.builder().url(imgBeans.get(0).getImageUrl()).imageRadius(5)
                                    .imageView(housepublishpublishContenImg)
                                    .build());
                        }
                    }, 1000);


                }
            } else if (requestCode == AppConstant.REQUEST_CODE_CHOOSE) {
                //验证手机号回来
                isVerify = "1";
                landlordMobile = data.getStringExtra("phone");

            } else if (requestCode == 1003) {
                 setResult(RESULT_OK,data);
                killMyself();
            }
            if (requestCode == 1004 && resultCode == RESULT_OK && data != null) {
                //选择地址返回
                if (!data.hasExtra("SelectAddressMapBean")) {
                    showMessage("选取地址异常");
                    return;
                }
                housepublishpublishContenJtdzTxt.setFocusableInTouchMode(true);
                housepublishpublishContenJtdzTxt.setFocusable(true);
                housepublishpublishContenJtdzTxt.requestFocus();
                SelectAddressMapBean selectAddressMapBean = (SelectAddressMapBean) data.getSerializableExtra("SelectAddressMapBean");
                housepublishpublishContenJtdzTxt.setText(selectAddressMapBean.getDetileAddress());
                housePublicBean.setAddressDetail(selectAddressMapBean.getDetileAddress());
                housePublicBean.setLgt(selectAddressMapBean.getLgt());
                housePublicBean.setLat(selectAddressMapBean.getLat());
            }
        }
    }

    /**
     * 控制popu显示
     */
    public void showPopuWindow() {
        CustomPopupWindow customPopupWindow = new CustomPopupWindow.Builder().contentView(CustomPopupWindow.inflateView(this, R.layout.user_popuwindow_view)).parentView(MystoryAddStoryPhoneSsqyTxt).backgroundDrawable(getResources().getDrawable(R.drawable.button_white_bg))
                .animationStyle(R.style.mypopwindow_anim_style).customListener(new CustomPopupWindow.CustomPopupWindowListener() {
                    @Override
                    public void initPopupView(View contentView) {

                    }
                }).isWrap(true).isHaveBackGround(true).build();
        View view1 = customPopupWindow.getContentView();
        TextView user_popuwindow_view_flb = view1.findViewById(R.id.user_popuwindow_view_flb);
        TextView user_popuwindow_view_zg = view1.findViewById(R.id.user_popuwindow_view_zg);
        user_popuwindow_view_flb.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                MystoryAddStoryPhoneSsqyTxt.setText("+63");
                customPopupWindow.dismiss();
            }
        });
        user_popuwindow_view_zg.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                MystoryAddStoryPhoneSsqyTxt.setText("+86");
                customPopupWindow.dismiss();
            }
        });
        customPopupWindow.show();
    }


}
